import fetch from 'common/src/utils/fetch';
/**
 * 学生成绩维护请求列表数据
 * @param {*} data obj
 */
export function listStudentScorePage(data = {}) {
    return fetch({
        url: '/api/scoremanagementservice/studentScoreChange/listStudentScoreChangePage',
        method: 'POST',
        data
    });
}
/**
 * 学生基本信息查询
 */
export function findStudentInfoByStudentId(studentId) {
    return fetch({
        url: '/api/scoremanagementservice/studentScoreQuery/findStudentInfoByStudentId?studentId=' + studentId,
        method: 'GET'
    });
}

/**
 * 查询学生课程信息
 */
export function queryStudentCourseInfo(data) {
    return fetch({
        url: '/api/scoremanagementservice/studentScoreChange/queryStudentCourseInfo',
        method: 'POST',
        data
    });
}
/**
 * 查询学生课程信息
 */
export function queryStudentTeachingClassInfoByCourse(data) {
    return fetch({
        url: '/api/scoremanagementservice/studentScoreChange/queryStudentTeachingClassInfoByCourse',
        method: 'POST',
        data
    });
}
/**
 * 通过课程code查询课程信息
 */

export function findCourseByCourseCode(courseCode) {
    return fetch({
        url: '/api/scoremanagementservice/scoreCourseWhite/findCourseByCourseCode?courseCode=' + courseCode,
        method: 'GET'
    });
}
/**
 *
 *
 * @export 提交学生成绩
 * @param {*} 学生成绩信息
 */
export function submitSpecialStudentScore(data) {
    return fetch({
        url: '/api/scoremanagementservice/studentScoreQuery/submitSpecialStudentScore',
        method: 'POST',
        data
    });
}
/**
 * 查询学生成绩变更/删除详情
 *
 */
export function findStudentScoreById(id, calendarId) {
    return fetch({
        url: '/api/scoremanagementservice/studentScoreChange/findStudentScoreById?id=' + id,
        method: 'GET'
    });
}
/**
 * 保存学生成绩更改
 */

export function saveAndCommitScoreChange(data) {
    return fetch({
        url: '/api/scoremanagementservice/studentScoreChange/saveAndCommitScoreChange',
        method: 'POST',
        data
    });
}
/**
 * 提交删除学生成绩
 */
export function delStudentScore(data) {
    return fetch({
        url: '/api/scoremanagementservice/studentScoreChange/delStudentScore',
        method: 'POST',
        data
    });
}
/**
 * 查询某门课程成绩详情
 * @param {*} id 成绩id
 */
export function findCourseScoreById(id) {
    return fetch({
        url: '/api/scoremanagementservice/studentScoreChange/findCourseScoreById?id=' + id,
        method: 'GET'
    });
}
/**
 * 学生成绩导出
 */
export function studentScoreChangeExport(params = {}, studentIds = '') {
    let url = '/api/scoremanagementservice/studentScoreChange/studentScoreChangeExport';
    let string = '';
    for (var key in params) {
        if (params[key] === '') {
            continue;
        }
        string += `${key}=${params[key]}&`;
    }
    let restApi = `${url}?${string.substring(0, string.length - 1)}`;
    return fetch({
        url: restApi,
        method: 'post',
        headers: { 'Content-Type': 'text/plain;charset=UTF-8' },
        responseType: 'blob',
        data: studentIds
    });
}
// export function studentScoreChangeExport(params = {}, studentIds = '') {
//     let url = '/api/scoremanagementservice/scoreMaintenance/exportScoreResultRound';
//     let string = '';
//     for (var key in params) {
//         if (params[key] === '') {
//             continue;
//         }
//         string += `${key}=${params[key]}&`;
//     }
//     let restApi = `${url}?${string.substring(0, string.length - 1)}`;
//     return fetch({
//         url: restApi,
//         method: 'post',
//         headers: { 'Content-Type': 'text/plain;charset=UTF-8' },
//         data: studentIds
//     });
// }

// export function exportScoreResultRoundByKey(key){
//     return fetch({
//         url: `/api/scoremanagementservice/scoreMaintenance/exportScoreResultRoundByKey?key=${key}`,
//         method: 'GET'
//     });
// }
/**
 * 查询课程性质
 */

export function getCourseNaturesList() {
    return fetch({
        url: '/api/scoremanagementservice/studentScoreChange/courseNatures',
        method: 'GET'
    });
}
